/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef INTERPRETER_H
#define INTERPRETER_H

#include "album.h"
#include "dom.h"

#include <boost/shared_ptr.hpp>

#include <string>
#include <list>
#include <iostream>

using namespace std;

/**
 * \brief This namespace contains all model-classes.
 * \author Michael Opitz
 */
namespace model {
	/** 
	 * \brief This class represents an interpreter.
	 */
	class interpreter {
	public:
		interpreter() {}
		/** 
		 * \brief interpreter creates an interpreter from an dom-node
		 * 
		 * \param node is the node from which the interpreter should be
		 * created
		 */
		interpreter(const model::dom &node);
		/** 
		 * \brief interpreter creates an interpreter
		 * 
		 * \param name is the name of the interpreter
		 * \param a is a list of albums
		 */
		interpreter(const string &name, const list<model::album> a)
		: _name(name), _albums(a) {}
		~interpreter() {}

		/** 
		 * \brief set_name sets the name of the interpreter
		 */
		void set_name(const string &n) {_name = n;}
		/** 
		 * \brief get_name returns the name of the interpreter
		 */
		const string& get_name() const {return _name;}

		/** 
		 * \brief parse parses the node to the internal interpreter
		 * structure
		 * 
		 * \param node is the node from which the interpreter should be
		 * created.
		 */
		void parse(const model::dom &node);

		/** 
		 * \brief set_albums sets the albums of the interpr.
		 */
		void set_albums(const list<model::album> a) {_albums = a;}
		/** 
		 * \brief get_albums returns the albums of the interpr.
		 */
		const list<model::album>& get_albums() const {return _albums;}
		/** 
		 * \brief get_albums returns the albums of the interpr.
		 */
		list<model::album>& get_albums() {return _albums;}

		/** 
		 * \brief print prints the interpreter. For debug purposes only.
		 */
		void print() const;
		/** 
		 * \brief to_xml prints the xml-structure of the interpreter
		 */
		string to_xml() const;
	private:
		string _name;
		list<model::album> _albums;
	};
}

#endif
